using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using PlugNT.Safe;
using PlugNT.Cms.Custom;
using PlugNT.Cms.Model;

namespace PlugNT.Cms.BLL
{
    public class Templet
    {

        private static readonly PlugNT.Cms.DAL.Templet dal = new PlugNT.Cms.DAL.Templet();








        public TempletInfo GetTempletInfo(int id)
        {
             return dal.GetTempletInfo(id);
        }







        public TempletInfo GetTempletInfo(string no)
        {
            return dal.GetTempletInfo(no);
        }






        public bool Add(TempletInfo model)
        {
            return dal.Add(model);
        }






        public bool Update(TempletInfo model)
        {
            return dal.Update(model);
        }







        public bool Delete(int id)
        {
            return dal.Delete(id);
        }








        public int Replace(int sysModelId, string oldString, string newString)
        {
            return dal.Replace(sysModelId, oldString, newString);
        }



        public DataTable GetList(int sysModelId, string tempString)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(" and file_create_path='" + StringHelper.SqlFilter(tempString) + "'");
            return dal.GetList(sysModelId, sb.ToString());
        }

        public DataTable GetList(int sysModelId, int channelId,int type)
        {
            StringBuilder sb = new StringBuilder();
            if (channelId > 0)
            {
                sb.Append(" and channel_id=" + channelId);
            }
            if (type >= 0)
            {
                sb.Append(" and type=" + type);
            }
            sb.Append(" order by sys_model_id");
            return dal.GetList(sysModelId, sb.ToString());
        }


        public Dictionary<string, string> GetHasTempletDictionary(int sysModelId)
        {
            return dal.GetHasTempletDictionary(sysModelId);
        }

    }
}

